<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta charset="utf-8">
    <title>RITMARE EDI</title>
    <link rel="stylesheet" href="css/assets.css">
    <link rel="stylesheet" href="https://www.get-it.it/cdn/ol/v3.2.0/css/ol.css">

    <script src="js/assets.js"></script>
    <script src="https://www.get-it.it/cdn/ol/v3.2.0/ol.js"></script>

    <script language="javascript">
        function onTemplateLoaded(data) {
            console.log("fatto");
        }
        $(document).ready(function() {
            edi.loadLocalTemplate("INSPIRE_dataset_ermes", "2.10", onTemplateLoaded);

            $("#ediml").hide();
            $("#sendMetadata").click(ediml.post);

        });
        function allowDrop(ev) {
            ev.preventDefault();
        }

        function drag(ev) {
            ev.dataTransfer.setData("text", ev.target.id);
        }

        function drop(ev) {
            ev.preventDefault();
            var data = ev.dataTransfer.getData("text");
            ev.target.appendChild(document.getElementById(data));
        }

        function toggleEDIML(which) {
            $('#ediml').toggle();
            if ( $("#ediml").is(":visible") ) {
                $(which).text("hide EDIML");
                edi.edimlOutput();
            } else {
                $(which).text("show EDIML");
            }
        }
    </script>
</head>
<body>
<div class="content-wrap">
    <div id="mdcontent"></div>
    <div id="ediml">

    </div>
    <div class="container">
        <h1>RITMARE EDI <span id="template-version"></span></h1>
        <script> var elements = []; </script>
        <div class="row">
            <div class="tabbable tabs-left">
                <ul id="myTab" class="nav nav-tabs">
                    <div class="bottoniera">
                        <button class="btn btn-primary" onclick="edi.setLanguage('it');">it</button>
                        <button class="btn btn-primary" onclick="edi.setLanguage('en');">en</button>
                        <br>
                        <button class="btn btn-danger debug" onclick="toggleEDIML(this);">show EDIML</button>
                        <br>
                        <button class="btn btn-danger" onclick="ediml.saveAs('pippo');">save EDIML</button>
                        <br>
                        <button class="btn btn-danger" onclick="ediml.load('pippo');">load EDIML</button>
                        <br>
                        <button class="btn btn-danger" style="display: none;" id="EDIMLDownload" onclick="ediml.downloadEDIML();">download EDIML</button>
                        <br>
                        <button class="btn btn-danger" style="display: none;" id="MDDownload" onclick="ediml.downloadMetadata();">download generated XML</button>
                        <br>
                        <button class="btn btn-primary" id="sendMetadata">send metadata</button>
                        <input type="checkbox" value="0" id="ignoreWarnings">ignore warnings
                    </div>
                </ul>
                <article class="span8" id="mdcontent">
                    <div id="theForm">
                        <div class="tab-content">

                        </div>
                    </div>
                </article>
            </div>
        </div>
    </div>
    <div id="debug">

    </div>
</div>
</body>
</html>
